package com.huifer.wgx.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * <p>Title : RtkPointEntity </p>
 * <p>Description : </p>
 *
 * @author huifer
 * @date 2019-03-20
 */
@Entity
@Table(name = "t_rtk_point", schema = "at15", catalog = "")
public class RtkPointEntity {

    private Long rtkId;
    private BigDecimal rtkX;
    private BigDecimal rtkY;
    private BigDecimal rtkZ;
    private Long workId;
    private Long personnelId;
    private Long fileId;
    private Collection<FieldPointEntity> tFieldPointsByRtkId;
    private WorkEntity tWorkByWorkId;
    private PersonnelEntity tPersonnelByPersonnelId;
    private FileEntity tFileByFileId;
    private String rtkName;



    @Id
    @Column(name = "rtk_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getRtkId() {
        return rtkId;
    }

    public void setRtkId(Long rtkId) {
        this.rtkId = rtkId;
    }

    @Basic
    @Column(name = "rtk_x")
    public BigDecimal getRtkX() {
        return rtkX;
    }

    public void setRtkX(BigDecimal rtkX) {
        this.rtkX = rtkX;
    }

    @Basic
    @Column(name = "rtk_y")
    public BigDecimal getRtkY() {
        return rtkY;
    }

    public void setRtkY(BigDecimal rtkY) {
        this.rtkY = rtkY;
    }

    @Basic
    @Column(name = "rtk_z")
    public BigDecimal getRtkZ() {
        return rtkZ;
    }

    public void setRtkZ(BigDecimal rtkZ) {
        this.rtkZ = rtkZ;
    }

    @Basic
    @Column(name = "work_id")
    public Long getWorkId() {
        return workId;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }

    @Basic
    @Column(name = "personnel_id")
    public Long getPersonnelId() {
        return personnelId;
    }

    public void setPersonnelId(Long personnelId) {
        this.personnelId = personnelId;
    }

    @Basic
    @Column(name = "file_id")
    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long fileId) {
        this.fileId = fileId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        RtkPointEntity that = (RtkPointEntity) o;
        return Objects.equals(rtkId, that.rtkId) &&
                Objects.equals(rtkX, that.rtkX) &&
                Objects.equals(rtkY, that.rtkY) &&
                Objects.equals(rtkZ, that.rtkZ) &&
                Objects.equals(workId, that.workId) &&
                Objects.equals(personnelId, that.personnelId) &&
                Objects.equals(fileId, that.fileId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(rtkId, rtkX, rtkY, rtkZ, workId, personnelId, fileId);
    }

    @OneToMany(mappedBy = "tRtkPointByRtkId")
    @JsonIgnore
    public Collection<FieldPointEntity> gettFieldPointsByRtkId() {
        return tFieldPointsByRtkId;
    }

    public void settFieldPointsByRtkId(
            Collection<FieldPointEntity> tFieldPointsByRtkId) {
        this.tFieldPointsByRtkId = tFieldPointsByRtkId;
    }

    @ManyToOne
    @JoinColumn(name = "work_id", referencedColumnName = "work_id",insertable = false,updatable = false)
    public WorkEntity gettWorkByWorkId() {
        return tWorkByWorkId;
    }

    public void settWorkByWorkId(WorkEntity tWorkByWorkId) {
        this.tWorkByWorkId = tWorkByWorkId;
    }

    @ManyToOne
    @JoinColumn(name = "personnel_id", referencedColumnName = "personnel_id",insertable = false,updatable = false)
    public PersonnelEntity gettPersonnelByPersonnelId() {
        return tPersonnelByPersonnelId;
    }

    public void settPersonnelByPersonnelId(PersonnelEntity tPersonnelByPersonnelId) {
        this.tPersonnelByPersonnelId = tPersonnelByPersonnelId;
    }

    @ManyToOne
    @JoinColumn(name = "file_id", referencedColumnName = "file_id",insertable = false,updatable = false)
    public FileEntity gettFileByFileId() {
        return tFileByFileId;
    }

    public void settFileByFileId(FileEntity tFileByFileId) {
        this.tFileByFileId = tFileByFileId;
    }
    public String getRtkName() {
        return rtkName;
    }

    @Basic
    @Column(name = "rtk_name")
    public void setRtkName(String rtkName) {
        this.rtkName = rtkName;
    }
}
